package com.xzw.test.springcloud;


import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.ZoneAvoidanceRule;
import feign.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

//参考地址: https://www.jianshu.com/p/59295c91dde7
//        https://blog.csdn.net/weixin_39786341/article/details/111392364
@EnableEurekaClient
@SpringBootApplication
@RibbonClient(value = "cloud-payment-service")
@EnableFeignClients(basePackages = {"com.xzw.test.springcloud.api.feign"})
public class FeignApp
{
    public static void main( String[] args )
    {
        SpringApplication.run(FeignApp.class,args);
    }

    // 负载均衡策略: https://www.jianshu.com/p/1bd66db5dc46
    @Bean
    public IRule feignRule() {
        return new ZoneAvoidanceRule();
    }

    @Bean
    public Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }
}
